package org.jspresso.framework.application.frontend.action;

import java.util.Map;

import org.jspresso.framework.action.IActionHandler;
import org.jspresso.framework.application.backend.persistence.hibernate.TestHibernateBackendController;

public class SwithTestSituationFrontAction<E,F,G> extends FrontendAction<E,F,G> {
	private boolean toTestSituation = false;

	@Override
	public boolean execute(IActionHandler actionHandler, Map<String, Object> context) {
		((TestHibernateBackendController)getBackendController(context)).setTestSituation(toTestSituation);
		((TestHibernateBackendController)getBackendController(context)).cleanupRequestResources(); // Clears the noTxSession for further processing
		((TestHibernateBackendController)getBackendController(context)).getHibernateSession().clear();
		return super.execute(actionHandler, context);
	}

	public void setToTestSituation(boolean toTestSituation) {
		this.toTestSituation = toTestSituation;
	}


}
